{include file="Public:header" /}
 <link rel="stylesheet" href="__PUBLIC__/Admin/bootstrap-datetimepicker-master/css/bootstrap-datetimepicker.min.css" media="screen"/>
<body class="gray-bg">
	<div class="wrapper wrapper-content animated fadeInRight">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
                    <div class="ibox-title">
                    	{if condition="$act eq 'add'"}
                    		<h5>添加广告位</h5>
                    	{else/}
                    		<h5>修改广告位</h5>
                    	{/if}
                        <div class="ibox-tools" style="margin-top: -6px;">
                            <button onclick="history.go(-1);" class="btn btn-primary"><i class="fa fa-arrow-left"></i> 返回</button>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <form action="__URL__/addAdvertPosition" method="post" class="form-horizontal" id="defaultForm" enctype="multipart/form-data">
                           <div class="form-group">
                                <label class="col-sm-2 control-label">广告位名称</label>
                                <div class="col-sm-6">
                                    <input type="text" name="name" value="{$advert['name']}" class="form-control">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            
                            <div class="form-group">
                                <label class="col-sm-2 control-label">广告位描述</label>
                                <div class="col-sm-6">
                                    <textarea name="describe" class="form-control" rows="4">{$advert['describe']}</textarea>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            
                             <div class="form-group">
                                <label class="col-sm-2 control-label">广告位宽度</label>
                                <div class="col-sm-6">
                                    <input type="text" name="width" value="1" class="form-control">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            
                            <div class="form-group">
                                <label class="col-sm-2 control-label">广告位高度</label>
                                <div class="col-sm-6">
                                    <input type="text" name="height" value="1" class="form-control">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                           <!-- <div class="form-group">
                                <label class="col-sm-2 control-label">广告位图标</label>
                                <div class="col-sm-6">
                                    <div id="file-pretty">
                                            <input type="file" name="ico_img" class="form-control">
                                            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 温馨提示：图片尺寸建议为：100*100，图片小于4M</span>
                                        <div class="form-group">
                                            <label class="font-noraml">文件选择（多选）</label>
                                            <input type="file" multiple="multiple" class="form-control">
                                        </div>
                                         {if condition="$activity['activity_img']"}
                                             <a target="_blank" href="__ROOT__{$advert.ico_img}"><i class="fa fa-image fa-2x"></i></a>
                                             <input type="hidden" name="old_ico_img" value="{$advert.ico_img}" />
                                        {/if} 
									
                                    </div>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div> -->
                             
                            <div class="form-group">
                                <label class="col-sm-2 control-label">是否显示</label>
                                <div class="i-check col-sm-6" style="line-height: 30px;">
                                <input type="radio" name="is_open" value="1"  {if condition="($advert['is_open'] eq 1) or ($advert['is_open'] eq '')"}checked="checked"{/if}/>
                              	  是&nbsp;
                                <input type="radio" name="is_open" value="2" {if condition="$advert['is_open'] eq 2"}checked="checked"{/if}/>
                               	 否&nbsp;
                            </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            
                            <input type="hidden" name="act" value="{$act}" />
                            <input type="hidden" name="id" value="{$id}" />
                            <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-2">
                                    <button class="btn btn-primary" type="submit">保存</button>
                                    <button class="btn btn-white" type="reset">取消</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
				</div>
			</div>
		</div>
	</div>


	{include file="Public:footer" /}

<script>
$(document).ready(function() {
    /**
     * 下面是进行插件初始化
     * 你只需传入相应的键值对
     * */
    $('#defaultForm').bootstrapValidator({
            message: 'This value is not valid',
            feedbackIcons: {/*输入框不同状态，显示图片的样式*/
            	  valid: 'glyphicon glyphicon-ok',
                  invalid: 'glyphicon glyphicon-remove',
                  validating: 'glyphicon glyphicon-refresh'
            },
            fields: {/*验证*/
            	name: {/*键名username和input name值对应*/
                    message: '广告位名称验证失败',
                    validators: {
                        notEmpty: {/*非空提示*/
                            message: '广告位名称不能为空'
                        },
                        stringLength: {/*长度提示*/
                            min: 2,
                            max: 30,
                            message: '广告位名称长度必须在2到30之间'
                        }/*最后一个没有逗号*/
                    }
                },
                describe: {/*键名username和input name值对应*/
                    message: '广告位描述验证失败',
                    validators: {
                        notEmpty: {/*非空提示*/
                            message: '广告位描述不能为空'
                        },
                        stringLength: {/*长度提示*/
                            min: 2,
                            max: 30,
                            message: '广告位描述长度必须在2到30之间'
                        }/*最后一个没有逗号*/
                    }
                },
                width: {/*键名username和input name值对应*/
                    message: '广告位宽度验证失败',
                    validators: {
                        notEmpty: {/*非空提示*/
                            message: '广告位宽度不能为空'
                        },
                        stringLength: {/*长度提示*/
                            min: 1,
                            max: 1000,
                            message: '广告位宽度长度必须在1到1000之间'
                        }/*最后一个没有逗号*/
                    }
                },
                height: {/*键名username和input name值对应*/
                    message: '广告位高度验证失败',
                    validators: {
                        notEmpty: {/*非空提示*/
                            message: '广告位高度不能为空'
                        },
                        stringLength: {/*长度提示*/
                            min: 1,
                            max: 1000,
                            message: '广告位高度必须在1到1000之间'
                        }/*最后一个没有逗号*/
                    }
                }
            }
            // 还有一个比较常用的就是submitHandler属性，它对应着提交按钮的事件方法。
            // submitHandler: function (validator, form, submitButton) {
                //alert("submit");
               /*  var menu_name = $("input[name='menu_name']").val();
                var link = $("input[name='link']").val();
                var ico = $("input[name='ico']").val();
                $.ajax({
                    url : '__URL__/addMenu',
                    type : 'get',
                    data : {'menu_name' : menu_name, 'link' : link, 'ico':ico},
                    dataType : 'json',
                    success : function(data){
                      alert(data.message);
                    }
                }); */
           // }
        });
});

</script>

<script type="text/javascript" src="__PUBLIC__/Admin/bootstrap-datetimepicker-master/js/bootstrap-datetimepicker.js" charset="UTF-8"></script>
<script type="text/javascript" src="__PUBLIC__/Admin/bootstrap-datetimepicker-master/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>

<script type="text/javascript">
        $('#datetimepicker6').datetimepicker({
             language:  'zh-CN',
             format: 'yyyy-mm-dd HH:ii',
             autoclose:true,//日期选择完成后是否关闭选择框
        });
        $('#datetimepicker7').datetimepicker({
            language:  'zh-CN',
            format: 'yyyy-mm-dd HH:ii',
            autoclose:true //Important! See issue #1075
        });
</script>

 <script src="__PUBLIC__/Admin/js/plugins/prettyfile/bootstrap-prettyfile.js"></script>
 <script type="text/javascript">
 $(function(){
    $('#file-pretty input[type="file"]').prettyFile();
 });

 //修改菜单
function lookImg(){
    $('#myModal').modal('show');
}
 </script>

       
</body>
</html>
